#include "types/common.h"
#include "types/record.h"
#include "types/errors.h"

#ifndef _record_info_h_
#define _record_info_h_

struct Info;

struct StringCompare
{
	public:
		inline bool isequal(string s1, string s2)
		{
			return s1 == s2;
		}
};

void load_file(HashMap<string, Info,StringCompare> & rec_info);
void commit_rec_info(string &tablename, UINT32 block_num);

class RecordInfo
{
public:
	static RecordInfo * inst()
	{
		if(ptr == NULL)
		{
			ptr = new RecordInfo;
		}
		return ptr;
	}
	
	UINT32 get_num_blocks(string &tblname);
	
	UINT32 get_record_size(string &tblname);
	UINT32 get_max_num_records(string &tblname);
	UINT32 get_num_records(string &tblname, UINT32 blocknum);
	
	RecordId get_empty_record(string &tablename);	
	
	void set_table_info(string &tblname, UINT32 num_slots);
private:
	RecordInfo();
	~RecordInfo();
	static RecordInfo *ptr;
};

#endif
